<template>
    <div
        class="device-check-write"
        v-if="pointinspectioncontents&&pointinspectioncontents.length!==0">
        <device-check-card-editable
            v-for="(item,key) in pointinspectioncontents"
            :key="item.pointinspectionname"
            :newColumns="columns"
            v-model="pointinspectioncontents[key]" />
    </div>
    <wp-null-data-area
        class="no-data"
        :null-data-msg="$st('wp_No_data')"
        v-else
        null-text-msg-color="rgba(0,0,0,0.6)"
    />
</template>

<script>
import DeviceCheckCardEditable from './DeviceCheckCardEditable';
import { apiService } from '@/api/apiService';
import { getPointInspectionResultParams } from '@/api/server';

export default {
    props: {
        modelValue: Array
    },
    emits: ['update:modelValue'],
    components: {
        DeviceCheckCardEditable
    },
    computed: {
        pointinspectioncontents: {
            get () {
                return this.modelValue;
            },
            set (val) {
                this.$emit('update:modelValue', val);
            }
        }
    },
    data () {
        return {
            columns: []
        };
    },
    mounted () {
        this.getDeviceCheckResultOptions();
    },
    methods: {
        getDeviceCheckResultOptions () {
            apiService({
                api: getPointInspectionResultParams,
                param: {},
                success: (data) => {
                    this.columns = [...data.value];
                }
            });
        }
    }

};
</script>

<style lang="scss" scoped>

.device-check-write{
    padding-bottom: 20px;
    height: calc(100vh - 44px - 53px - 20px);
    overflow: auto;
}
</style>
